<?php
App::uses('AppController', 'Controller');
/**
 * AboutUs Controller
 */
class AboutUsController extends AppController {

    public $uses = array('Article');
/**
 * index method
 *
 * @return void
 */
	public function index() {
		$this->Article->recursive = -1;
		$this->set('article', $this->Article->findById(5));
        
        $cond = array('conditions' => array('category_id' => 1), 'order' => 'created_date DESC', 'limit' => 5);
        $this->set('articleLastest', $this->Article->find('all', $cond));
		$this->set('id', 5);
	}
	
	/**
 * view method
 *
 * @throws NotFoundException
 * @param string $id
 * @return void
 */
	public function detail($id = null) {
		if (!$this->Article->exists($id)) {
			throw new NotFoundException(__('Invalid article'));
		}
		
		$this->Article->recursive = -1;
		
		$options = array('conditions' => array('Article.' . $this->Article->primaryKey => $id));
		$this->set('article', $this->Article->find('first', $options));
                
        $cond = array('conditions' => array('category_id' => 1), 'order' => 'created_date DESC', 'limit' => 5);
        $this->set('articleLastest', $this->Article->find('all', $cond));
		$this->set('id', $id);
		
		$this->render('index');
	}
}
